<?php
/* QQ:34734852
 * 业务联系：小鱼
 */
class str{
	private $String  = 'EyouPHP字符串处理类';
	private $CodeArr = array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'); 
	private $Code    = 'UTF-8';
	public  $data    = '';
	
	public function __construct() {
		if ( !function_exists('mb_strlen') ) {
		   return false;	
		}
	}
	
	public function  String( $String = '' ) {
		$this -> String = $this -> data = $String;
		$this -> Code   = mb_detect_encoding( $this -> String, $this -> CodeArr );
		return $this;
	}
	
	public function sub( $min = 0, $max = 1) {
		$this -> data = mb_substr( $this -> String, $min, $max, $this -> Code);
		return $this;
	}
	
	public function urlcode( $t = true ) {
		echo $this -> data = $t ? rawurlencode( $this -> String ) : rawurldecode( $this -> String);
		return $this;
	}
	
	public function per( $t = true ) {
		$this -> data = $t ? strtolower( $this -> String ) : strtoupper( $this -> String );
		return $this;
	}
	
	
}